package com.example.weibo_app.service.impl;

import com.example.weibo_app.domain.Comment;
import com.example.weibo_app.mapper.CommentMapper;
import com.example.weibo_app.service.CommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CommentServiceImpl implements CommentService {

    @Autowired
    private CommentMapper commentMapper;

    @Override
    public int addComment(Comment comment) {
        return commentMapper.insertComment(comment);
    }

    @Override
    public List<Comment> getCommentsByArticleId(Integer articleId) {
        return commentMapper.selectCommentsByArticleId(articleId);
    }

    @Override
    public List<Comment> getCommentsByUserId(Integer userId) {
        return commentMapper.selectCommentsByUserId(userId);
    }
}

